home *** CD-ROM | disk | FTP | other *** search
Text File | 1995-11-04 | 35.5 KB | 1,211 lines |
- diff -u -r --new-file last-version/docs/smbstatus.1 samba-1.9.14p2/docs/smbstatus.1
- --- last-version/docs/smbstatus.1 Mon Mar 20 22:44:50 1995
- +++ samba-1.9.14p2/docs/smbstatus.1 Sat Nov 4 23:20:23 1995
- @@ -21,6 +21,9 @@
- .I -d
- gives verbose output.
-
- +.I -p
- +print a list of smbd processes and exit. Useful for scripting.
- +
- .SH ENVIRONMENT VARIABLES
- Not applicable.
-
- diff -u -r --new-file last-version/source/change-log samba-1.9.14p2/source/change-log
- --- last-version/source/change-log Mon Oct 30 17:28:11 1995
- +++ samba-1.9.14p2/source/change-log Sat Nov 4 23:21:02 1995
- @@ -1605,10 +1605,21 @@
- - fix client bug for long dirs in NT1 mode.
- Thanks to Erwin Authried (erwin@ws1.atv.tuwien.ac.at)
- - switched to a safer (but probably slower) readbraw implementation
- + - released p1
- + - readbraw fix from Stefaan.Eeckels@eunet.lu
- + - fixed groups bug when user is in 1 group
- + - fixed NT1 dir bug
- + - changed default protocol in client to NT1
- + - changed trans2 to not return both names in long listing if long
- + name is 8.3
- + - made stat of "" return RONLY if not writeable drive
- + - wrapped strcpy() to stop nulls propogating (hack)
- + - made rename and unlink look at share locks on file
- + - clitar memory leak fix from jjm@jjm.com
- + - added -p option to smbstatus to list smbd processes
- + - released p2
-
-
- -
- -
- ==========
- todo:
-
- @@ -1640,6 +1651,8 @@
- write-only shares
-
- document cnvchar stuff
- +
- +allow smbd to serve user and group lists to win95
-
- UNRESOLVED PROBLEMS
- ===================
- diff -u -r --new-file last-version/source/client.c samba-1.9.14p2/source/client.c
- --- last-version/source/client.c Mon Oct 30 17:13:49 1995
- +++ samba-1.9.14p2/source/client.c Sat Nov 4 21:31:10 1995
- @@ -46,7 +46,7 @@
- #define SHORT_TIMEOUT (5*1000)
-
- int name_type = ' ';
- -int max_protocol = PROTOCOL_LANMAN2;
- +int max_protocol = PROTOCOL_NT1;
-
-
- time_t newer_than = 0;
- @@ -484,7 +484,118 @@
- return(True);
- }
-
- +/****************************************************************************
- +interpret a short filename structure
- +The length of the structure is returned
- +****************************************************************************/
- +static int interpret_short_filename(char *p,file_info *finfo)
- +{
- + finfo->mode = CVAL(p,21);
- +
- + finfo->ctime = make_unix_date(p+22,True);
- + finfo->mtime = finfo->atime = finfo->ctime;
- + finfo->size = IVAL(p,26);
- + strcpy(finfo->name,p+30);
- +
- + return(DIR_STRUCT_SIZE);
- +}
- +
- +/****************************************************************************
- +interpret a long filename structure - this is mostly guesses at the moment
- +The length of the structure is returned
- +The structure of a long filename depends on the info level. 260 is used
- +by NT and 2 is used by OS/2
- +****************************************************************************/
- +static int interpret_long_filename(int level,char *p,file_info *finfo)
- +{
- + if (finfo)
- + memcpy(finfo,&def_finfo,sizeof(*finfo));
- +
- + switch (level)
- + {
- + case 1: /* OS/2 understands this */
- + if (finfo)
- + {
- + finfo->ctime = make_unix_date2(p+4,True);
- + finfo->atime = make_unix_date2(p+8,True);
- + finfo->mtime = make_unix_date2(p+12,True);
- + finfo->size = IVAL(p,16);
- + finfo->mode = CVAL(p,24);
- + strcpy(finfo->name,p+27);
- + }
- + return(28 + CVAL(p,26));
- +
- + case 2: /* this is what OS/2 uses mostly */
- + if (finfo)
- + {
- + finfo->ctime = make_unix_date2(p+4,True);
- + finfo->atime = make_unix_date2(p+8,True);
- + finfo->mtime = make_unix_date2(p+12,True);
- + finfo->size = IVAL(p,16);
- + finfo->mode = CVAL(p,24);
- + strcpy(finfo->name,p+31);
- + }
- + return(32 + CVAL(p,30));
-
- + /* levels 3 and 4 are untested */
- + case 3:
- + if (finfo)
- + {
- + finfo->ctime = make_unix_date2(p+8,True);
- + finfo->atime = make_unix_date2(p+12,True);
- + finfo->mtime = make_unix_date2(p+16,True);
- + finfo->size = IVAL(p,20);
- + finfo->mode = CVAL(p,28);
- + strcpy(finfo->name,p+33);
- + }
- + return(SVAL(p,4)+4);
- +
- + case 4:
- + if (finfo)
- + {
- + finfo->ctime = make_unix_date2(p+8,True);
- + finfo->atime = make_unix_date2(p+12,True);
- + finfo->mtime = make_unix_date2(p+16,True);
- + finfo->size = IVAL(p,20);
- + finfo->mode = CVAL(p,28);
- + strcpy(finfo->name,p+37);
- + }
- + return(SVAL(p,4)+4);
- +
- + case 260: /* NT uses this, but also accepts 2 */
- + if (finfo)
- + {
- + extern int serverzone;
- + int ret = SVAL(p,0);
- + int namelen;
- + p += 4; /* next entry offset */
- + p += 4; /* fileindex */
- + finfo->ctime = interpret_long_date(p); p += 8;
- + finfo->atime = interpret_long_date(p); p += 8;
- + finfo->mtime = interpret_long_date(p); p += 8; p += 8;
- + finfo->mtime += DSTDiff(finfo->mtime) - serverzone;
- + finfo->ctime += DSTDiff(finfo->ctime) - serverzone;
- + finfo->atime += DSTDiff(finfo->atime) - serverzone;
- + finfo->size = IVAL(p,0); p += 8;
- + p += 8; /* alloc size */
- + finfo->mode = CVAL(p,0); p += 4;
- + namelen = IVAL(p,0); p += 4;
- + p += 4; /* EA size */
- + p += 2; /* short name len? */
- + p += 24; /* short name? */
- + StrnCpy(finfo->name,p,namelen);
- + return(ret);
- + }
- + return(SVAL(p,0));
- + }
- +
- + DEBUG(1,("Unknown long filename format %d\n",level));
- + return(SVAL(p,0));
- +}
- +
- +
- +
- +
- /****************************************************************************
- act on the files in a dir listing
- ****************************************************************************/
- @@ -937,7 +1048,6 @@
- strcat(mask,"*");
- }
-
- - expand_mask(mask,True);
- do_dir(inbuf,outbuf,mask,attribute,NULL,recurse);
-
- do_dskattr();
- @@ -1732,8 +1842,9 @@
-
- if (finfo->mtime == 0 || finfo->mtime == -1)
- {
- + time_t t = time(NULL);
- finfo->mtime = finfo->atime = finfo->ctime =
- - time(NULL) + GMT_TO_LOCAL*TimeDiff(0);
- + t + GMT_TO_LOCAL*TimeDiff(t);
- }
-
- CVAL(outbuf,smb_com) = SMBcreate;
- @@ -2405,6 +2516,53 @@
- }
-
- /****************************************************************************
- +rename some files
- +****************************************************************************/
- +static void cmd_rename(char *inbuf,char *outbuf )
- +{
- + pstring src,dest;
- + fstring buf,buf2;
- + char *p;
- +
- + strcpy(src,cur_dir);
- + strcpy(dest,cur_dir);
- +
- + if (!next_token(NULL,buf,NULL) || !next_token(NULL,buf2,NULL))
- + {
- + DEBUG(0,("rename <src> <dest>\n"));
- + return;
- + }
- + strcat(src,buf);
- + strcat(dest,buf2);
- +
- + bzero(outbuf,smb_size);
- + set_message(outbuf,1,4 + strlen(src) + strlen(dest),True);
- +
- + CVAL(outbuf,smb_com) = SMBmv;
- + SSVAL(outbuf,smb_tid,cnum);
- + SSVAL(outbuf,smb_vwv0,aHIDDEN | aDIR | aSYSTEM);
- + setup_pkt(outbuf);
- +
- + p = smb_buf(outbuf);
- + *p++ = 4;
- + strcpy(p,src);
- + p = skip_string(p,1);
- + *p++ = 4;
- + strcpy(p,dest);
- +
- + send_smb(outbuf);
- + receive_smb(inbuf,CLIENT_TIMEOUT);
- +
- + if (CVAL(inbuf,smb_rcls) != 0)
- + {
- + DEBUG(0,("%s renaming files\n",smb_errstr(inbuf)));
- + return;
- + }
- +
- +}
- +
- +
- +/****************************************************************************
- toggle the prompt flag
- ****************************************************************************/
- static void cmd_prompt(void)
- @@ -2737,13 +2895,12 @@
- sec_mode = SVAL(inbuf,smb_vwv1);
- max_xmit = SVAL(inbuf,smb_vwv2);
- sesskey = IVAL(inbuf,smb_vwv6);
- - servertime = make_unix_date(inbuf+smb_vwv8);
- + servertime = make_unix_date(inbuf+smb_vwv8,False);
- serverzone = SVALS(inbuf,smb_vwv10)*60;
- - servertime -= DSTDiff(servertime);
- - if (Protocol >= PROTOCOL_COREPLUS) {
- - readbraw_supported = ((SVAL(inbuf,smb_vwv5) & 0x1) != 0);
- - writebraw_supported = ((SVAL(inbuf,smb_vwv5) & 0x2) != 0);
- - }
- + if (Protocol >= PROTOCOL_COREPLUS) {
- + readbraw_supported = ((SVAL(inbuf,smb_vwv5) & 0x1) != 0);
- + writebraw_supported = ((SVAL(inbuf,smb_vwv5) & 0x2) != 0);
- + }
- crypt_len = smb_buflen(inbuf);
- memcpy(cryptkey,smb_buf(inbuf),8);
- DEBUG(3,("max mux %d\n",SVAL(inbuf,smb_vwv3)));
- @@ -3299,6 +3456,7 @@
- {"mget",cmd_mget,"<mask> get all the matching files"},
- {"put",cmd_put,"<local name> [remote name] put a file"},
- {"mput",cmd_mput,"<mask> put all matching files"},
- + {"rename",cmd_rename,"<src> <dest> rename some files"},
- {"more",cmd_more,"<remote name> view a remote file with your pager"},
- {"mask",cmd_select,"<mask> mask all filenames against this"},
- {"del",cmd_del,"<mask> delete all matching files"},
- diff -u -r --new-file last-version/source/clitar.c samba-1.9.14p2/source/clitar.c
- --- last-version/source/clitar.c Wed Sep 20 00:30:15 1995
- +++ samba-1.9.14p2/source/clitar.c Sat Nov 4 23:05:01 1995
- @@ -427,6 +427,7 @@
- reopen_connection(inbuf,outbuf))
- {
- do_atar(rname,lname,finfo1);
- + free(inbuf);free(outbuf);
- return;
- }
-
- @@ -854,7 +855,8 @@
- * from the mod. time, and the access time to current time
- */
- finfo->mtime = finfo->ctime = strtol(hb->dbuf.mtime, NULL, 8);
- - finfo->atime = time(NULL) + GMT_TO_LOCAL*TimeDiff(0);
- + finfo->atime = time(NULL);
- + finfo->atime += GMT_TO_LOCAL*TimeDiff(finfo->atime);
- finfo->size = unoct(hb->dbuf.size, sizeof(hb->dbuf.size));
-
- return True;
- @@ -994,7 +996,7 @@
- setup_pkt(outbuf);
-
- SSVAL(outbuf,smb_vwv0,fnum);
- - SIVAL(outbuf,smb_vwv1,finfo.mtime-TimeDiff(0));
- + SIVAL(outbuf,smb_vwv1,finfo.mtime-TimeDiff(finfo.mtime));
-
- DEBUG(3,("Setting date to %s (0x%X)",
- asctime(LocalTime(&finfo.mtime,LOCAL_TO_GMT)),
- diff -u -r --new-file last-version/source/includes.h samba-1.9.14p2/source/includes.h
- --- last-version/source/includes.h Sun Oct 22 13:39:14 1995
- +++ samba-1.9.14p2/source/includes.h Sat Nov 4 21:51:34 1995
- @@ -959,6 +959,9 @@
- #define F_UNLCK 0
- #endif /* HAVE_FCNTL_LOCK == 0 */
-
- +#ifndef strcpy
- +#define strcpy(dest,src) StrCpy(dest,src)
- +#endif
-
-
- /* possibly wrap the malloc calls */
- diff -u -r --new-file last-version/source/ipc.c samba-1.9.14p2/source/ipc.c
- --- last-version/source/ipc.c Thu Sep 21 20:49:48 1995
- +++ samba-1.9.14p2/source/ipc.c Sat Nov 4 18:58:24 1995
- @@ -943,7 +943,8 @@
-
- {
- struct tm *t;
- - time_t unixdate = time(NULL) + GMT_TO_LOCAL*TimeDiff(0);
- + time_t unixdate = time(NULL);
- + unixdate += GMT_TO_LOCAL*TimeDiff(unixdate);
-
- t = LocalTime(&unixdate,0);
-
- @@ -953,7 +954,7 @@
- CVAL(p,9) = t->tm_min;
- CVAL(p,10) = t->tm_sec;
- CVAL(p,11) = 0; /* hundredths of seconds */
- - SSVALS(p,12,TimeDiff(0)/60); /* timezone in minutes from GMT */
- + SSVALS(p,12,TimeDiff(unixdate)/60); /* timezone in minutes from GMT */
- SSVAL(p,14,10000); /* timer interval in 0.0001 of sec */
- CVAL(p,16) = t->tm_mday;
- CVAL(p,17) = t->tm_mon + 1;
- diff -u -r --new-file last-version/source/locking.c samba-1.9.14p2/source/locking.c
- --- last-version/source/locking.c Fri Sep 15 20:48:58 1995
- +++ samba-1.9.14p2/source/locking.c Sat Nov 4 22:03:18 1995
- @@ -164,6 +164,68 @@
- }
-
- /*******************************************************************
- +get the share mode of a file using the files name
- +********************************************************************/
- +int get_share_mode_byname(int cnum,char *fname,int *pid)
- +{
- + struct stat st;
- + pstring lname;
- + char *name;
- + int fd2;
- + char buf[16];
- + int ret;
- + time_t t;
- +
- + *pid = 0;
- +
- + name = lname;
- +
- + strcpy(name,lp_lockdir());
- + standard_sub(cnum,name);
- + trim_string(name,"","/");
- + if (!*name) return(0);
- + name += strlen(name);
- +
- + if (stat(fname,&st) == -1)
- + return(0);
- +
- + sprintf(name,"/share.%d.%d",(int)st.st_dev,(int)st.st_ino);
- +
- + fd2 = open(lname,O_RDONLY,0);
- + if (fd2 < 0) return(0);
- +
- + if (read(fd2,buf,16) != 16) {
- + close(fd2);
- + unlink(lname);
- + return(0);
- + }
- + close(fd2);
- +
- + t = IVAL(buf,0);
- + ret = IVAL(buf,4);
- + *pid = IVAL(buf,8);
- +
- + if (IVAL(buf,12) != LOCKING_VERSION) {
- + if (!unlink(lname)) DEBUG(2,("Deleted old locking file %s",lname));
- + *pid = 0;
- + return(0);
- + }
- +
- + if (*pid && !process_exists(*pid)) {
- + ret=0;
- + *pid = 0;
- + }
- +
- + if (! *pid) unlink(lname); /* XXXXX race, race */
- +
- + if (*pid)
- + DEBUG(5,("Read share file %s mode 0x%X pid=%d\n",lname,ret,*pid));
- +
- + return(ret);
- +}
- +
- +
- +/*******************************************************************
- del the share mode of a file, if we set it last
- ********************************************************************/
- void del_share_mode(int fnum)
- diff -u -r --new-file last-version/source/printing.c samba-1.9.14p2/source/printing.c
- --- last-version/source/printing.c Thu Sep 21 20:27:02 1995
- +++ samba-1.9.14p2/source/printing.c Thu Nov 2 09:59:36 1995
- @@ -62,13 +62,13 @@
-
- /* get the print command for the service. */
- tstr = command;
- - if (tstr == NULL) {
- + if (!syscmd || !tstr) {
- DEBUG(0,("No print command for service `%s'\n", SERVICE(snum)));
- return (NULL);
- }
-
- /* copy the command into the buffer for extensive meddling. */
- - strcpy(syscmd, tstr);
- + StrnCpy(syscmd, tstr, sizeof(pstring) - 1);
-
- /* look for "%s" in the string. If there is no %s, we cannot print. */
- if (!strstr(syscmd, "%s") && !strstr(syscmd, "%f")) {
- @@ -83,7 +83,7 @@
- the subshell causes a "cd" to be executed.
- Only use the full path if there isn't a / preceding the %s */
- if (iOffset==0 || syscmd[iOffset-1] != '/') {
- - strcpy(filename,Connections[cnum].connectpath);
- + StrnCpy(filename,Connections[cnum].connectpath,sizeof(filename));
- trim_string(filename,"","/");
- strcat(filename,"/");
- strcat(filename,filename1);
- diff -u -r --new-file last-version/source/reply.c samba-1.9.14p2/source/reply.c
- --- last-version/source/reply.c Mon Oct 30 17:31:07 1995
- +++ samba-1.9.14p2/source/reply.c Sat Nov 4 22:32:47 1995
- @@ -492,7 +492,8 @@
- under WfWg - weird! */
- if (! (*fname))
- {
- - mode = 0x12;
- + mode = aHIDDEN | aDIR;
- + if (!CAN_WRITE(cnum)) mode |= aRONLY;
- size = 0;
- mtime = 0;
- ok = True;
- @@ -1165,6 +1166,7 @@
- if (fmode & aRONLY) return(False);
- if ((fmode & ~dirtype) & (aHIDDEN | aSYSTEM))
- return(False);
- + if (!check_file_sharing(cnum,fname)) return(False);
- return(True);
- }
-
- @@ -1183,6 +1185,7 @@
- int count=0;
- int error = ERRnoaccess;
- BOOL has_wild;
- + BOOL exists=False;
-
- *directory = *mask = 0;
-
- @@ -1214,6 +1217,7 @@
- strcat(directory,"/");
- strcat(directory,mask);
- if (can_delete(directory,cnum,dirtype) && !sys_unlink(directory)) count++;
- + if (!count) exists = file_exist(directory,NULL);
- } else {
- void *dirptr = NULL;
- char *dname;
- @@ -1245,8 +1249,12 @@
- }
- }
-
- - if (count == 0)
- - return(UNIXERROR(ERRDOS,error));
- + if (count == 0) {
- + if (exists)
- + return(ERROR(ERRDOS,error));
- + else
- + return(UNIXERROR(ERRDOS,error));
- + }
-
- outsize = set_message(outbuf,0,0,True);
-
- @@ -1330,6 +1338,11 @@
- ret = transfer_file(fd,Client,nread-predict,header,4+predict,
- startpos+predict);
- }
- +
- + if (ret != nread+4)
- + DEBUG(0,("ERROR: file read failure on %s at %d for %d bytes (%d)\n",
- + fname,startpos,nread,ret));
- +
- #else
- ret = read_file(fnum,header+4,startpos,nread,nread,-1,False);
- if (ret < mincount) ret = 0;
- @@ -1338,11 +1351,6 @@
- transfer_file(0,Client,0,header,4+ret,0);
- #endif
-
- -
- - if (ret != nread+4)
- - DEBUG(0,("ERROR: file read failure on %s at %d for %d bytes (%d)\n",
- - fname,startpos,nread,ret));
- -
- DEBUG(5,("readbraw finished\n"));
- return -1;
- }
- @@ -2451,13 +2459,12 @@
- static BOOL can_rename(char *fname,int cnum)
- {
- struct stat sbuf;
- - int fmode;
-
- if (!CAN_WRITE(cnum)) return(False);
-
- if (sys_lstat(fname,&sbuf) != 0) return(False);
- - fmode = dos_mode(cnum,fname,&sbuf);
- - if (fmode & aRONLY) return(False);
- + if (!check_file_sharing(cnum,fname)) return(False);
- +
- return(True);
- }
-
- @@ -2475,6 +2482,7 @@
- int count=0;
- int error = ERRnoaccess;
- BOOL has_wild;
- + BOOL exists=False;
-
- *directory = *mask = 0;
-
- @@ -2509,6 +2517,7 @@
- if (resolve_wildcards(directory,newname) &&
- can_rename(directory,cnum) &&
- !sys_rename(directory,newname)) count++;
- + if (!count) exists = file_exist(directory,NULL);
- } else {
- void *dirptr = NULL;
- char *dname;
- @@ -2543,8 +2552,12 @@
- }
- }
-
- - if (count == 0)
- - return(UNIXERROR(ERRDOS,error));
- + if (count == 0) {
- + if (exists)
- + return(ERROR(ERRDOS,error));
- + else
- + return(UNIXERROR(ERRDOS,error));
- + }
-
- outsize = set_message(outbuf,0,0,True);
-
- @@ -2927,12 +2940,13 @@
- CHECK_FNUM(fnum,cnum);
- CHECK_ERROR(fnum);
-
- - /* Convert the DOS times into dos times. Ignore create
- + /* Convert the DOS times into unix times. Ignore create
- time as UNIX can't set this.
- */
-
- - unix_times.actime = make_unix_date2(inbuf+smb_vwv3);
- - unix_times.modtime = make_unix_date2(inbuf+smb_vwv5);
- + /* XXXX - should this include the DST offset? */
- + unix_times.actime = make_unix_date2(inbuf+smb_vwv3,False);
- + unix_times.modtime = make_unix_date2(inbuf+smb_vwv5,False);
- unix_times.actime += LOCAL_TO_GMT*TimeDiff(unix_times.actime);
- unix_times.modtime += LOCAL_TO_GMT*TimeDiff(unix_times.modtime);
-
- diff -u -r --new-file last-version/source/server.c samba-1.9.14p2/source/server.c
- --- last-version/source/server.c Mon Oct 30 17:08:57 1995
- +++ samba-1.9.14p2/source/server.c Sat Nov 4 22:11:05 1995
- @@ -47,9 +47,6 @@
- /* the last message the was processed */
- int last_message = -1;
-
- -/* does getgroups return ints or gid_t ?? */
- -BOOL groups_use_ints = True;
- -
- /* a useful macro to debug the last message processed */
- #define LAST_MESSAGE() smb_fn_name(last_message)
-
- @@ -1168,6 +1165,26 @@
- return(AFAIL);
- }
-
- +/*******************************************************************
- +check if the share mode on a file allows it to be deleted or unlinked
- +return True if sharing doesn't prevent the operation
- +********************************************************************/
- +BOOL check_file_sharing(int cnum,char *fname)
- +{
- + int pid=0;
- + int share_mode = get_share_mode_byname(cnum,fname,&pid);
- +
- + if (!pid || !share_mode) return(True);
- +
- + if (share_mode == DENY_DOS)
- + return(pid == getpid());
- +
- + /* XXXX exactly what share mode combinations should be allowed for
- + deleting/renaming? */
- + return(False);
- +}
- +
- +
- /****************************************************************************
- open a file with a share mode
- ****************************************************************************/
- @@ -2287,7 +2304,15 @@
- dynamically using some very ugly code */
- if (ngroups > 0)
- {
- - for (i=0;i<ngroups;i++)
- + /* does getgroups return ints or gid_t ?? */
- + static BOOL groups_use_ints = True;
- +
- + if (groups_use_ints &&
- + ngroups == 1 &&
- + SVAL(igroups,2) == 0x4242)
- + groups_use_ints = False;
- +
- + for (i=0;groups_use_ints && i<ngroups;i++)
- if (igroups[i] == 0x42424242)
- groups_use_ints = False;
-
- @@ -2705,6 +2730,7 @@
- int outsize;
- int secword=0;
- BOOL doencrypt = SMBENCRYPT();
- + time_t t = time(NULL);
-
- if (lp_security()>=SEC_USER) secword |= 1;
- if (doencrypt) secword |= 2;
- @@ -2723,9 +2749,9 @@
- SSVAL(outbuf,smb_vwv5,raw); /* tell redirector we support
- readbraw writebraw (possibly) */
- SIVAL(outbuf,smb_vwv6,getpid());
- - SSVAL(outbuf,smb_vwv10, TimeDiff(0) / 60);
- + SSVAL(outbuf,smb_vwv10, TimeDiff(t)/60);
-
- - put_dos_date(outbuf,smb_vwv8,time(NULL));
- + put_dos_date(outbuf,smb_vwv8,t);
-
- Protocol = PROTOCOL_LANMAN1;
-
- @@ -2742,6 +2768,7 @@
- int outsize;
- int secword=0;
- BOOL doencrypt = SMBENCRYPT();
- + time_t t = time(NULL);
-
- if (lp_security()>=SEC_USER) secword |= 1;
- if (doencrypt) secword |= 2;
- @@ -2767,8 +2794,8 @@
- SSVAL(outbuf,smb_vwv3,lp_maxmux());
- SSVAL(outbuf,smb_vwv4,1);
- SSVAL(outbuf,smb_vwv5,raw); /* readbraw and/or writebraw */
- - SSVAL(outbuf,smb_vwv10, TimeDiff(0)/60);
- - put_dos_date(outbuf,smb_vwv8,time(NULL));
- + SSVAL(outbuf,smb_vwv10, TimeDiff(t)/60);
- + put_dos_date(outbuf,smb_vwv8,t);
-
- return (outsize);
- }
- @@ -2813,7 +2840,7 @@
- SIVAL(outbuf,smb_vwv5+1,0xFFFF); /* raw size */
- SIVAL(outbuf,smb_vwv9+1,capabilities); /* capabilities */
- put_long_date(outbuf+smb_vwv11+1,time(NULL));
- - SSVALS(outbuf,smb_vwv15+1,TimeDiff(0)/60);
- + SSVALS(outbuf,smb_vwv15+1,TimeDiff(time(NULL))/60);
-
- return (smb_len(outbuf)+4);
- }
- @@ -3181,7 +3208,10 @@
- crec.uid = Connections[cnum].uid;
- crec.gid = Connections[cnum].gid;
- StrnCpy(crec.name,lp_servicename(snum),sizeof(crec.name)-1);
- - crec.start = time(NULL) + GMT_TO_LOCAL*TimeDiff(0);
- + {
- + time_t t = time(NULL);
- + crec.start = t + GMT_TO_LOCAL*TimeDiff(t);
- + }
- {
- extern struct from_host Client_info;
- StrnCpy(crec.machine,Client_info.name,sizeof(crec.machine)-1);
- diff -u -r --new-file last-version/source/smb.h samba-1.9.14p2/source/smb.h
- --- last-version/source/smb.h Sun Oct 22 13:49:05 1995
- +++ samba-1.9.14p2/source/smb.h Sat Nov 4 22:13:27 1995
- @@ -703,8 +703,11 @@
- int disk_free(char *path,int *bsize,int *dfree,int *dsize);
- char *uidtoname(int uid);
- char *gidtoname(int gid);
- +int get_share_mode_byname(int cnum,char *fname,int *pid);
- +BOOL check_file_sharing(int cnum,char *fname);
- +char *StrCpy(char *dest,char *src);
- int unix_error_packet(char *inbuf,char *outbuf,int def_class,uint32 def_code,int line);
- -time_t make_unix_date2(void *date_ptr);
- +time_t make_unix_date2(void *date_ptr,BOOL add_dst);
- int cached_error_packet(char *inbuf,char *outbuf,int fnum,int line);
- mode_t unix_mode(int cnum,int dosmode);
- BOOL check_name(char *name,int cnum);
- @@ -773,7 +776,7 @@
- int name_len(char *s);
- void dos_clean_name(char *s);
- void unix_clean_name(char *s);
- -time_t make_unix_date(void *date_ptr);
- +time_t make_unix_date(void *date_ptr,BOOL add_dst);
- BOOL lanman2_match( char *str, char *regexp, int case_sig, BOOL autoext);
- BOOL trim_string(char *s,char *front,char *back);
- int byte_checksum(char *buf,int len);
- @@ -817,8 +820,6 @@
- int interpret_security(char *str,int def);
- int ChDir(char *path);
- int smb_buflen(char *buf);
- -int interpret_short_filename(char *p,file_info *finfo);
- -int interpret_long_filename(int level,char *p,file_info *finfo);
- unsigned long interpret_addr(char *str);
- void mangle_name_83(char *s);
- BOOL lp_casesignames(void);
- diff -u -r --new-file last-version/source/status.c samba-1.9.14p2/source/status.c
- --- last-version/source/status.c Wed Jul 5 01:30:06 1995
- +++ samba-1.9.14p2/source/status.c Sat Nov 4 23:19:07 1995
- @@ -41,6 +41,7 @@
- void *dir;
- char *s;
- BOOL firstopen=True;
- + BOOL processes_only=False;
-
- charset_initialise();
-
- @@ -52,16 +53,19 @@
- return(1);
- }
-
- - while ((c = getopt(argc, argv, "ds:")) != EOF) {
- + while ((c = getopt(argc, argv, "pds:")) != EOF) {
- switch (c) {
- case 'd':
- verbose = 1;
- break;
- + case 'p':
- + processes_only = 1;
- + break;
- case 's':
- strcpy(servicesf, optarg);
- break;
- default:
- - fprintf(stderr, "Usage: %s [-d] [-s configfile]\n", *argv);
- + fprintf(stderr, "Usage: %s [-p] [-d] [-s configfile]\n", *argv);
- return (-1);
- }
- }
- @@ -91,21 +95,34 @@
-
- uid = getuid();
-
- - printf("\nSamba version %s\n",VERSION);
- -
- - printf("Service uid gid pid machine\n");
- - printf("----------------------------------------------\n");
- + if (!processes_only) {
- + printf("\nSamba version %s\n",VERSION);
- +
- + printf("Service uid gid pid machine\n");
- + printf("----------------------------------------------\n");
- + }
-
- while (!feof(f))
- {
- + static int last_pid = 0;
- if (fread(&crec,sizeof(crec),1,f) != 1)
- break;
- - if (crec.magic == 0x280267 && process_exists(crec.pid))
- - printf("%-10.10s %-8s %-8s %5d %-8s (%s) %s",
- - crec.name,uidtoname(crec.uid),gidtoname(crec.gid),crec.pid,
- - crec.machine,crec.addr,asctime(LocalTime(&crec.start,0)));
- + if (crec.magic == 0x280267 && process_exists(crec.pid)) {
- + if (processes_only) {
- + if (last_pid != crec.pid)
- + printf("%d\n",crec.pid);
- + last_pid = crec.pid; /* XXXX we can still get repeats, have to
- + add a sort at some time */
- + }
- + else
- + printf("%-10.10s %-8s %-8s %5d %-8s (%s) %s",
- + crec.name,uidtoname(crec.uid),gidtoname(crec.gid),crec.pid,
- + crec.machine,crec.addr,asctime(LocalTime(&crec.start,0)));
- + }
- }
- fclose(f);
- +
- + if (processes_only) exit(0);
-
- printf("\n");
-
- diff -u -r --new-file last-version/source/testparm.c samba-1.9.14p2/source/testparm.c
- --- last-version/source/testparm.c Wed Jul 5 14:20:21 1995
- +++ samba-1.9.14p2/source/testparm.c Sat Nov 4 22:45:32 1995
- @@ -78,6 +78,7 @@
- if (argc < 4)
- {
- printf("Press enter to see a dump of your service definitions\n");
- + fflush(stdout);
- getc(stdin);
- lp_dump();
- }
- diff -u -r --new-file last-version/source/trans2.c samba-1.9.14p2/source/trans2.c
- --- last-version/source/trans2.c Thu Sep 21 20:49:49 1995
- +++ samba-1.9.14p2/source/trans2.c Sat Nov 4 20:29:20 1995
- @@ -445,7 +445,10 @@
- SIVAL(p,0,mode); p += 4;
- SIVAL(p,0,strlen(fname)); p += 4;
- SIVAL(p,0,0); p += 4;
- - name_convert(p+2,fname,True,SNUM(cnum));
- + if (!is_8_3(fname))
- + name_convert(p+2,fname,True,SNUM(cnum));
- + else
- + *(p+2) = 0;
- strupper(p+2);
- SSVAL(p,0,strlen(p+2));
- p += 2 + 24;
- @@ -1200,11 +1203,13 @@
- tvs.actime = st.st_atime;
- mode = dos_mode(cnum,fname,&st);
-
- +
- + /* XXXX should these include the DST offsets? */
- switch (info_level)
- {
- case 1:
- - tvs.actime = make_unix_date2(pdata+l1_fdateLastAccess);
- - tvs.modtime = make_unix_date2(pdata+l1_fdateLastWrite);
- + tvs.actime = make_unix_date2(pdata+l1_fdateLastAccess,False);
- + tvs.modtime = make_unix_date2(pdata+l1_fdateLastWrite,False);
- mode = SVAL(pdata,l1_attrFile);
- size = IVAL(pdata,l1_cbFile);
- break;
- @@ -1212,15 +1217,15 @@
- case 2:
- if(IVAL(pdata,l2_cbList) || total_data>32)
- return(ERROR(ERRDOS,ERROR_EAS_NOT_SUPPORTED));
- - tvs.actime = make_unix_date2(pdata+l1_fdateLastAccess);
- - tvs.modtime = make_unix_date2(pdata+l1_fdateLastWrite);
- + tvs.actime = make_unix_date2(pdata+l1_fdateLastAccess,False);
- + tvs.modtime = make_unix_date2(pdata+l1_fdateLastWrite,False);
- mode = SVAL(pdata,l1_attrFile);
- size = IVAL(pdata,l1_cbFile);
- break;
-
- case 3:
- - tvs.actime = make_unix_date2(pdata+8);
- - tvs.modtime = make_unix_date2(pdata+12);
- + tvs.actime = make_unix_date2(pdata+8,False);
- + tvs.modtime = make_unix_date2(pdata+12,False);
- size = IVAL(pdata,16);
- mode = IVAL(pdata,24);
- break;
- @@ -1228,8 +1233,8 @@
- case 4:
- if (IVAL(pdata,28) != 0 || total_data>36)
- return(ERROR(ERRDOS,ERROR_EAS_NOT_SUPPORTED));
- - tvs.actime = make_unix_date2(pdata+8);
- - tvs.modtime = make_unix_date2(pdata+12);
- + tvs.actime = make_unix_date2(pdata+8,False);
- + tvs.modtime = make_unix_date2(pdata+12,False);
- size = IVAL(pdata,16);
- mode = IVAL(pdata,24);
- break;
- diff -u -r --new-file last-version/source/util.c samba-1.9.14p2/source/util.c
- --- last-version/source/util.c Mon Oct 23 20:19:33 1995
- +++ samba-1.9.14p2/source/util.c Sat Nov 4 22:14:20 1995
- @@ -273,9 +273,7 @@
- int extra_time_offset = 0;
-
- static int timediff = 0;
- -static int dst_off = 0;
-
- -
- /*******************************************************************
- init the time differences
- ********************************************************************/
- @@ -290,35 +288,75 @@
- tm_local = *(localtime(&t));
-
- timediff = mktime(&tm_utc) - mktime(&tm_local);
- -
- -#ifndef NO_ISDST
- - dst_off = tm_local.tm_isdst? (60*60) : 0;
- -#endif
- }
-
-
- /*******************************************************************
- -return the current DST offset
- +return the DST offset for a particular time
- +We keep a table of DST offsets to prevent calling localtime() on each
- +call of this function. This saves a LOT of time on many unixes.
- ********************************************************************/
- int DSTDiff(time_t t)
- {
- - static BOOL initialised = False;
- - int ret=0;
- - if (!initialised) {TimeInit(); initialised=True;}
- + static struct dst_table {time_t start,end; BOOL is_dst;} *dst_table = NULL;
- + static int table_size = 0;
- + int i;
- + BOOL is_dst = False;
-
- - ret = dst_off;
- + if (t == 0) t = time(NULL);
-
- -#ifdef STRICT_TIMEZONES
- #ifndef NO_ISDST
- - {
- - struct tm tm_local;
- - tm_local = *(localtime(&t));
- - ret = (tm_local.tm_isdst ? 60*60 : 0);
- - }
- -#endif
- + for (i=0;i<table_size;i++)
- + if (t >= dst_table[i].start && t <= dst_table[i].end) break;
- +
- + if (i<table_size) {
- + is_dst = dst_table[i].is_dst;
- + } else {
- + time_t low,high;
- +
- + dst_table = (struct dst_table *)Realloc(dst_table,
- + sizeof(dst_table[0])*(i+1));
- + if (!dst_table) {
- + table_size = 0;
- + return(0);
- + }
- +
- + table_size++;
- +
- + dst_table[i].is_dst = is_dst = (localtime(&t)->tm_isdst?True:False);;
- + dst_table[i].start = dst_table[i].end = t;
- +
- + /* no entry will cover more than 6 months */
- + low = t - 3*30*24*60*60;
- + high = t + 3*30*24*60*60;
- +
- + /* widen the new entry using two bisection searches */
- + while (low+60*60 < dst_table[i].start) {
- + t = ((low + dst_table[i].start)/2);
- + if ((localtime(&t)->tm_isdst?True:False) == is_dst)
- + dst_table[i].start = t;
- + else
- + low = t;
- + }
- +
- + while (high-60*60 > dst_table[i].end) {
- + t = ((high + dst_table[i].end)/2);
- + if ((localtime(&t)->tm_isdst?True:False) == is_dst)
- + dst_table[i].end = t;
- + else
- + high = t;
- + }
- +
- +/*
- + DEBUG(1,("Added DST entry from %s ",
- + asctime(localtime(&dst_table[i].start))));
- + DEBUG(1,("to %s (%d)\n",asctime(localtime(&dst_table[i].end)),
- + dst_table[i].is_dst));
- +*/
- + }
- #endif
-
- - return(ret - (extra_time_offset*60));
- + return((is_dst?60*60:0) - (extra_time_offset*60));
- }
-
- /****************************************************************************
- @@ -637,11 +675,31 @@
- }
-
- /****************************************************************************
- +this is a safer strcpy(), meant to prevent core dumps when nasty things happen
- +****************************************************************************/
- +char *StrCpy(char *dest,char *src)
- +{
- + char *d = dest;
- + if (!dest) return(NULL);
- + if (!src) {
- + *dest = 0;
- + return(dest);
- + }
- + while ((*d++ = *src++)) ;
- + return(dest);
- +}
- +
- +/****************************************************************************
- line strncpy but always null terminates. Make sure there is room!
- ****************************************************************************/
- char *StrnCpy(char *dest,char *src,int n)
- {
- char *d = dest;
- + if (!dest) return(NULL);
- + if (!src) {
- + *dest = 0;
- + return(dest);
- + }
- while (n-- && (*d++ = *src++)) ;
- *d = 0;
- return(dest);
- @@ -872,10 +930,11 @@
- /*******************************************************************
- create a unix date from a dos date
- ********************************************************************/
- -time_t make_unix_date(void *date_ptr)
- +time_t make_unix_date(void *date_ptr,BOOL add_dst)
- {
- uint32 dos_date=0;
- struct tm t;
- + time_t ret;
-
- dos_date = IVAL(date_ptr,0);
-
- @@ -887,13 +946,16 @@
- t.tm_yday = 1;
- t.tm_isdst = -1;
-
- - return (TimeLocal(&t,GMT_TO_LOCAL));
- + ret = TimeLocal(&t,GMT_TO_LOCAL);
- +
- + if (add_dst) ret += DSTDiff(ret);
- + return(ret);
- }
-
- /*******************************************************************
- create a unix date from a dos date
- ********************************************************************/
- -time_t make_unix_date2(void *date_ptr)
- +time_t make_unix_date2(void *date_ptr,BOOL add_dst)
- {
- uint32 x,x2;
-
- @@ -901,7 +963,7 @@
- x2 = ((x&0xFFFF)<<16) | ((x&0xFFFF0000)>>16);
- SIVAL(&x,0,x2);
-
- - return(make_unix_date((void *)&x));
- + return(make_unix_date((void *)&x,add_dst));
- }
-
-
- @@ -2566,7 +2628,7 @@
- }
-
- /* this is used to prevent lots of mallocs of size 1 */
- -char *null_string = NULL;
- +static char *null_string = NULL;
-
- /****************************************************************************
- set a string value, allocing the space for the string
- @@ -2582,10 +2644,9 @@
- if (l == 0)
- {
- if (!null_string)
- - {
- - null_string = (char *)malloc(1);
- - *null_string = 0;
- - }
- + null_string = (char *)malloc(1);
- +
- + *null_string = 0;
- *dest = null_string;
- }
- else
- @@ -3603,116 +3664,6 @@
- SIVAL(p,0,tlow);
- SIVAL(p,4,thigh);
- }
- -
- -
- -/****************************************************************************
- -interpret a short filename structure
- -The length of the structure is returned
- -****************************************************************************/
- -int interpret_short_filename(char *p,file_info *finfo)
- -{
- - finfo->mode = CVAL(p,21);
- -
- - finfo->mtime = finfo->atime = finfo->ctime = make_unix_date(p+22);
- - finfo->size = IVAL(p,26);
- - strcpy(finfo->name,p+30);
- -
- - return(DIR_STRUCT_SIZE);
- -}
- -
- -/****************************************************************************
- -interpret a long filename structure - this is mostly guesses at the moment
- -The length of the structure is returned
- -The structure of a long filename depends on the info level. 260 is used
- -by NT and 2 is used by OS/2
- -****************************************************************************/
- -int interpret_long_filename(int level,char *p,file_info *finfo)
- -{
- - if (finfo)
- - memcpy(finfo,&def_finfo,sizeof(*finfo));
- -
- - switch (level)
- - {
- - case 1: /* OS/2 understands this */
- - if (finfo)
- - {
- - finfo->ctime = make_unix_date2(p+4);
- - finfo->atime = make_unix_date2(p+8);
- - finfo->mtime = make_unix_date2(p+12);
- - finfo->size = IVAL(p,16);
- - finfo->mode = CVAL(p,24);
- - strcpy(finfo->name,p+27);
- - }
- - return(28 + CVAL(p,26));
- -
- - case 2: /* this is what OS/2 uses mostly */
- - if (finfo)
- - {
- - finfo->ctime = make_unix_date2(p+4);
- - finfo->atime = make_unix_date2(p+8);
- - finfo->mtime = make_unix_date2(p+12);
- - finfo->size = IVAL(p,16);
- - finfo->mode = CVAL(p,24);
- - strcpy(finfo->name,p+31);
- - }
- - return(32 + CVAL(p,30));
- -
- - /* levels 3 and 4 are untested */
- - case 3:
- - if (finfo)
- - {
- - finfo->ctime = make_unix_date2(p+8);
- - finfo->atime = make_unix_date2(p+12);
- - finfo->mtime = make_unix_date2(p+16);
- - finfo->size = IVAL(p,20);
- - finfo->mode = CVAL(p,28);
- - strcpy(finfo->name,p+33);
- - }
- - return(SVAL(p,4)+4);
- -
- - case 4:
- - if (finfo)
- - {
- - finfo->ctime = make_unix_date2(p+8);
- - finfo->atime = make_unix_date2(p+12);
- - finfo->mtime = make_unix_date2(p+16);
- - finfo->size = IVAL(p,20);
- - finfo->mode = CVAL(p,28);
- - strcpy(finfo->name,p+37);
- - }
- - return(SVAL(p,4)+4);
- -
- - case 260: /* NT uses this, but also accepts 2 */
- - if (finfo)
- - {
- - int ret = SVAL(p,0);
- - int namelen;
- - p += 4; /* next entry offset */
- - p += 4; /* fileindex */
- - finfo->ctime = interpret_long_date(p); p += 8;
- - finfo->atime = interpret_long_date(p); p += 8;
- - finfo->mtime = interpret_long_date(p); p += 8; p += 8;
- - finfo->mtime += DSTDiff(finfo->mtime) - serverzone;
- - finfo->ctime += DSTDiff(finfo->ctime) - serverzone;
- - finfo->atime += DSTDiff(finfo->atime) - serverzone;
- - finfo->size = IVAL(p,0); p += 8;
- - p += 8; /* alloc size */
- - finfo->mode = CVAL(p,0); p += 4;
- - namelen = IVAL(p,0); p += 4;
- - p += 4; /* EA size */
- - p += 2; /* short name len? */
- - p += 24; /* short name? */
- - StrnCpy(finfo->name,p,namelen);
- - return(ret);
- - }
- - return(SVAL(p,0));
- - }
- -
- - DEBUG(1,("Unknown long filename format %d\n",level));
- - return(SVAL(p,0));
- -}
- -
- -
-
- /*******************************************************************
- sub strings with useful parameters
- diff -u -r --new-file last-version/source/version.h samba-1.9.14p2/source/version.h
- --- last-version/source/version.h Mon Oct 30 17:32:32 1995
- +++ samba-1.9.14p2/source/version.h Sat Nov 4 23:21:27 1995
- @@ -1 +1 @@
- -#define VERSION "1.9.14p1"
- +#define VERSION "1.9.14p2"
-